home *** CD-ROM | disk | FTP | other *** search
File List | 1988-07-08 | 5.6 KB | 187 lines |
- Microsoft MACRO Assembler Version 3.00 Page 1-1
- 07-08-88
-
-
- 1 ;--------------------------------------
- ---------------------------------------
- 2 ;
- 3 ; CPUID.ASM
- 4 ; Version 1.1
- 5 ;
- 6 ; A procedure used by SYSID.PAS.
- 7 ;
- 8 ; CPUID returns these values in A
- X:
- 9 ; AH7 : (not used, alwa
- ys 0)
- 10 ; AH6 : (not used, alwa
- ys 0)
- 11 ; AH5 : (not used, alwa
- ys 0)
- 12 ; AH4 : (not used, alwa
- ys 0)
- 13 ; AH3 : 1 if CPU mishan
- dles interrupts of multi-prefix string
- 14 ; instructions (I
- ntel)
- 15 ; AH2 : 1 if PUSH SP wr
- ites, then decrements (80286)
- 16 ; AH1 : 1 if shift inst
- ructions ignore high 3 bits in register
- 17 ; displacement (8
- 018x, 80286)
- 18 ; AH0 : 1 if prefetch i
- nstruction queue is 6 bytes (80x86)
- 19 ; AL : 0 if no coproce
- ssor present
- 20 ; 1 if 8087 prese
- nt
- 21 ; 2 if 80287 pres
- ent
- 22 ;
- 23 ; CPUID uses self-modifying code
- to determine the length of the prefetch
- 24 ; instruction queue and should th
- erefore be run only once in the course
- 25 ; of the calling program.
- 26 ;
- 27 ; CPUID was shamelessly stolen fr
- om Bob Smith's article "Chips in
- 28 ; Transition," PC Tech Journal 4:
- 4, p. 56. It was assembled into
- 29 ; CPUID.OBJ with MASM Version 3.0
- .
- 30 ;
- 31 ; Steve Grant
- 32 ; Long Beach, CA
- 33 ; July 8, 1988
- 34 ;
- Microsoft MACRO Assembler Version 3.00 Page 1-2
- 07-08-88
-
-
- 35 ;--------------------------------------
- ---------------------------------------
- 36
- 37 .287
- 38 0000 code segment byte public
- 39 assume cs:code,ds:code
- 40 public cpuid
- 41 0000 cpuid proc near
- 42 0000 55 push bp
- 43 0001 8B EC mov bp,sp
- 44 0003 33 C0 xor ax,ax
- 45 0005 50 push ax
- 46 0006 B9 FFFF mov cx,0FFFFH
- 47 0009 FB sti
- 48 000A F3/ 26: AC rep lods byte ptr es:[si]
- 49 000D 58 pop ax
- 50 000E E3 03 jcxz a1
- 51 0010 80 CC 08 or ah,08H
- ; if CPU is Intel
- 52 0013 a1:
- 53 0013 50 push ax
- 54 0014 54 push sp
- 55 0015 58 pop ax
- 56 0016 3B C4 cmp ax,sp
- 57 0018 58 pop ax
- 58 0019 75 03 jne a2
- 59 001B 80 CC 04 or ah,04H
- ; if cpu is 8028x
- 60 001E a2:
- 61 001E 50 push ax
- 62 001F B1 21 mov cl,21H
- 63 0021 B0 FF mov al,0FFH
- 64 0023 D2 E0 shl al,cl
- 65 0025 58 pop ax
- 66 0026 74 03 jz a3
- 67 0028 80 CC 02 or ah,02H
- ; if cpu is 8018x or 8028x
- 68 002B a3:
- 69 002B 50 push ax
- 70 002C B5 00 mov ch,0
- 71 002E 1E push ds
- 72 002F 0E push cs
- 73 0030 1F pop ds
- 74 0031 FA cli
- 75 0032 EB 00 jmp $+2
- ; empty queue
- 76 0034 C6 06 003A R 00 mov byte ptr a4,0
- 77 0039 B1 db 0B1H
- ; MOV CL,...
- 78 003A 01 a4: db 1
- ; ...1
- 79 003B FB sti
- 80 003C 1F pop ds
- 81 003D 58 pop ax
- Microsoft MACRO Assembler Version 3.00 Page 1-3
- 07-08-88
-
-
- 82 003E E3 03 jcxz a5
- 83 0040 80 CC 01 or ah,01H
- ; if PIQ length=6 (80x86)
- 84 0043 a5:
- 85 0043 FA cli
- 86 0044 D9 36 007C R fnstenv ndp_env
- 87 0048 FB sti
- 88 0049 DB E3 fninit
- 89 004B D9 3E 008A R fnstcw ndp_cw
- 90 004F 80 3E 008B R 03 cmp byte ptr ndp_cw+1,03h
- 91 0054 B0 00 mov al,0
- 92 0056 75 22 jne a6
- 93 0058 80 26 008A R 7F and byte ptr ndp_cw,7FH
- 94 005D 9B D9 2E 008A R fldcw ndp_cw
- 95 0062 9B DB E1 fdisi
- 96 0065 9B D9 3E 008A R fstcw ndp_cw
- 97 006A 9B D9 26 007C R fldenv ndp_env
- 98 006F F6 06 008A R 80 test byte ptr ndp_cw,80H
- 99 0074 B0 01 mov al,1
- 100 0076 75 02 jnz a6
- 101 0078 B0 02 mov al,2
- 102 007A a6:
- 103 007A 5D pop bp
- 104 007B C3 ret
- 105 007C ndp_env label word
- 106 007C 07 [ dw 7 dup (0)
- 107 0000
- 108 ]
- 109
- 110 008A ndp_cw label word
- 111 008A 0000 dw 0
- 112 008C cpuid endp
- 113 008C code ends
- 114 end
-
- Microsoft MACRO Assembler Version 3.00 Page Symbols
- -1
- 07-08-88
-
-
- Segments and Groups:
-
- N a m e Size Align Combine Class
-
- CODE . . . . . . . . . . . . . . 008C BYTE PUBLIC
-
- Symbols:
-
- N a m e Type Value Attr
-
- A1 . . . . . . . . . . . . . . . L NEAR 0013 CODE
- A2 . . . . . . . . . . . . . . . L NEAR 001E CODE
- A3 . . . . . . . . . . . . . . . L NEAR 002B CODE
- A4 . . . . . . . . . . . . . . . L NEAR 003A CODE
- A5 . . . . . . . . . . . . . . . L NEAR 0043 CODE
- A6 . . . . . . . . . . . . . . . L NEAR 007A CODE
- CPUID. . . . . . . . . . . . . . N PROC 0000 CODE Global Length
- =008C
- NDP_CW . . . . . . . . . . . . . L WORD 008A CODE
- NDP_ENV. . . . . . . . . . . . . L WORD 007C CODE
-
- 49698 Bytes free
-
- Warning Severe
- Errors Errors
- 0 0
-